<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    /* 指定显示/隐藏的过渡样式 */
    .fade-enter-active, .fade-leave-active {
      transition: opacity .5s;
    }
    /* 指定隐藏时的样式 */
    .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
      opacity: 0;
    }
    
    /* 指定显示的过渡样式 */
    .xxx-enter-active {
      transition: all 1s;
    }
    /* 指定隐藏的过渡样式 */
    .xxx-leave-active {
      transition: all 3s;
    }
    /* 指定隐藏时的样式 */
    .xxx-enter, .xxx-leave-to {
      opacity: 0;
      transform: translateX(20px);
    }
  </style>
</head>
<body>
  <div id="demo">
    <button v-on:click="show = !show">
      Toggle
    </button>
    <transition name="fade">
      <p v-show="show">hello</p>
    </transition>
  </div>
  <div id="demo1">
    <button @click="show = !show">
      Toggle
    </button>
    <transition name="xxx">
      <p v-show="show">hello</p>
    </transition>
  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
  <script>
    new Vue({
      el: '#demo',
      data: {
        show: true
      }
    })
    new Vue({
      el: '#demo1',
      data: {
        show: true
      }
    })
  </script>
</body>
</html>